
/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  August 23rd 2009 7:37:33 PM PDT                              */
/*      Machine:  10.16.139.101                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/2rv9bxgqaneog8w4.pkg.js h:bbqws739                        */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/2rv9bxgqaneog8w4.pkg.js                                   */
function UIStaticHomeFilter(root, assoc_id, item_data, num_visible, data, stream, combine_highlights_and_nf) {
	this.parent.construct(this, root, item_data, data);
	copy_properties(this, {root:root, stream:stream, assoc_id:assoc_id, num_visible:num_visible, combine_highlights_and_nf:combine_highlights_and_nf});
	if (this.stream) {
		UIStaticHomeFilter.activate(this, this.stream.getID());
		var clickHandler = function () {
			UIStaticHomeFilter.active[this.stream.getID()].each(function (filter) {
				if (this !== filter) {
					filter.deselectAll();
				}
			}.bind(this));
		}.bind(this);
		this.addClickHandler(clickHandler);
		this.stream.setHomeFilter(this);
	}
	var transitionHandler = UIStaticHomeFilter.handlePageTransition.bind(this);
	PageTransitions.registerHandler(transitionHandler);
	this.editModeLink = root.find("a.UIFilterList_EditLink");
	this.editModeLink.listen("click", this.enableEdit.bind(this));
	Arbiter.subscribe(Arbiter.LIST_EDITOR_LISTS_CHANGED, this._listsChanged.bind(this), Arbiter.SUBSCRIBE_NEW);
}
UIStaticHomeFilter.extend("UIFilterList");
UIStaticHomeFilter.prototype = {loadFilterByKey:function (filterKey) {
	if (filterKey == UIIntentionalStream.FEED_FILTER_KEY_NEW_HIGHLIGHTS && this.combine_highlights_and_nf) {
		filterKey = UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED;
	}
	for (var i = 0, l = this.items.length; i < l; i++) {
		var item = this.items[i];
		if (item.data.filter == filterKey) {
			return this.selectItem(item);
		}
	}
	return false;
}, _listsChanged:function (message, data) {
	if (message == Arbiter.LIST_EDITOR_LISTS_CHANGED) {
		if (data.is_new_list) {
			var data = {new_key:"fl" + "_" + data.list_info.list_id, id:this.assoc_id};
			new AsyncRequest().setURI("/ajax/filterlist.php").setData(data).setHandler(function (new_key) {
				goURI(URI("/home.php").addQueryData({filter:new_key}), true);
			}.bind(null, data.new_key)).send();
		} else {
			goURI(URI("/home.php"), true);
		}
	}
}};
UIStaticHomeFilter.handlePageTransition = function (uri) {
	var extraData = uri.getQueryData();
	if (!this.stream || extraData.disable_nile || extraData.ref || (!(uri.getPath() == "/home.php") && !(uri.getPath() == "/home_pipe.php"))) {
		return false;
	}
	this.loadFilterByKey(extraData.filter);
	var kwargs = {filter:extraData.filter};
	this.stream.refresh(UIIntentionalStream.REFRESH_TRANSITION, extraData, kwargs);
	return true;
};
UIStaticHomeFilter.activate = function (filter, streamID) {
	if (!UIStaticHomeFilter.active[streamID]) {
		UIStaticHomeFilter.active[streamID] = [];
	}
	UIStaticHomeFilter.active[streamID].push(filter);
};
UIStaticHomeFilter.active = {};
UIStaticHomeFilter.prototype.enableEdit = function () {
	if (this.homeFilter) {
		this.homeFilter.beginEditMode();
	} else {
		Bootloader.loadComponents("UIHomeFilter", this.loadedResources.bind(this));
	}
};
UIStaticHomeFilter.prototype.loadedResources = function () {
	this.homeFilter = new UIHomeFilter(this.controller, this.assoc_id, this.items, this.num_visible, this.data, true);
	this.homeFilter.beginEditMode();
};
function AdsFeedback(container, suppress_dialog) {
	this.ad_container = container;
	this.suppress_dialog = suppress_dialog;
	var ads_feedback = DOM.scry(this.ad_container, "div.ads_feedback");
	if (ads_feedback && ads_feedback.length) {
		this.feedback_div = ads_feedback[0];
	} else {
		if (ge("div.ads_feedback_new")) {
			this.feedback_div = DOM.find(this.ad_container, "div.ads_feedback_new");
		} else {
			this.feedback_div = null;
		}
	}
	var thumbs_up = DOM.scry(this.ad_container, "a.thumbs_up");
	if (thumbs_up) {
		this.thumbs_up = thumbs_up[0];
	}
	var thumbs_dn = DOM.scry(this.ad_container, "a.thumbs_dn");
	if (thumbs_dn) {
		this.thumbs_dn = thumbs_dn[0];
	}
	var hide = DOM.scry(this.ad_container, "a.hide");
	if (hide) {
		this.hide = hide[0];
	}
	this.disable_if_dn = true;
	var next_ad_buttons = DOM.scry(this.ad_container, "a.next_ad");
	if (next_ad_buttons) {
		this.next_ad_button = next_ad_buttons[0];
	}
	this.usage_data = [];
	this.click_usage_data = [];
	this.enc_log_data = "";
	this.cancel_btn = {name:"cancel", label:_tx("Cancel"), className:"inputaux"};
	this.buttons = [Dialog.OK, this.cancel_btn];
	if (this.thumbs_up) {
		this.thumbs_up.listen("click", this._thumbs_up.bind(this));
	}
	if (this.thumbs_dn) {
		this.thumbs_dn.listen("click", this._thumbs_dn.bind(this));
	}
	if (this.hide) {
		this.hide.listen("click", this._thumbs_dn.bind(this));
	}
	if (this.next_ad_button) {
		this.next_ad_button.listen("click", this._cycle_muffin.bind(this));
	}
}
copy_properties(AdsFeedback, {K_THUMBS_UP:1, K_THUMBS_DN:0, K_THUMBS_UP_FEEDBACK:1});
copy_properties(AdsFeedback.prototype, {_thumbs_dn:function () {
	this.isPositive = false;
	this.click_usage_data = this.usage_data.clone();
	this.click_usage_data.push(AdsFeedback.K_THUMBS_DN);
	if (this.suppress_dialog) {
		this._cycle_muffin();
		if (this.disable_if_dn) {
			this._disable_ad();
		}
		reason_value = 0;
		other_text = "";
		this.click_usage_data.push(reason_value, other_text);
		this._log();
	} else {
		var async = new AsyncRequest().setMethod("GET").setReadOnly(true).setURI(muffinize("/muffins/ajax/feedback.php"));
		new Dialog().setAsync(async).setButtons(this.buttons).setHandler(this._form_handler.bind(this)).show();
	}
	return false;
}, _thumbs_up:function () {
	this.isPositive = true;
	this.click_usage_data = this.usage_data.clone();
	this.click_usage_data.push(AdsFeedback.K_THUMBS_UP, AdsFeedback.K_THUMBS_UP_FEEDBACK, "");
	hide(this.thumbs_up);
	hide(this.thumbs_dn);
	this._log();
	return false;
}, _log:function () {
	if (this._alreadyLogged) {
		return;
	}
	this._alreadyLogged = true;
	var serialized_usage_data = this.click_usage_data.join("|");
	if (serialized_usage_data) {
		var params = "type=usage" + "&params[]=" + escapeURI("ads_feedback") + "&params[]=" + escapeURI(serialized_usage_data) + "&";
		new AsyncSignal(muffinize("/muffins/ajax/tracking_log.php?" + params)).send();
	}
	if (this.enc_log_data) {
		var adscribe_params = "type=event" + "&params[]=" + escapeURI("ads_feedback") + "&params[]=" + escapeURI(this.enc_log_data) + "&params[]=" + escapeURI(this.isPositive) + "&";
		new AsyncSignal(muffinize("/muffins/ajax/tracking_log.php?" + adscribe_params)).send();
	}
}, _form_handler:function (r) {
	if (r == this.cancel_btn) {
		var reason_value = 0;
		var other_text = "";
	} else {
		if (r == Dialog.OK) {
			var reason_select = $("ads_feedback_select");
			var reason_value = get_form_select_value(reason_select);
			var other_text = $("ads_feedback_form_other_text").value;
			if (!this.isPositive) {
				if (this.disable_if_dn) {
					this._disable_ad();
				}
				this._cycle_muffin();
			}
			if (this.thumbs_up) {
				hide(this.thumbs_up);
			}
			if (this.thumbs_dn) {
				hide(this.thumbs_dn);
			}
		}
	}
	this.click_usage_data.push(reason_value, other_text);
	this._log();
}, _disable_ad:function () {
	if (this.enc_log_data) {
		var params = "ld=" + escapeURI(this.enc_log_data) + "&";
		new AsyncSignal(muffinize("/muffins/ajax/disable_muffin.php?" + params)).send();
	}
}, set_usage_data:function (usage_data) {
	this.usage_data = usage_data;
	return this;
}, set_log_data:function (enc_log_data) {
	this.enc_log_data = enc_log_data;
	return this;
}, _cycle_muffin:abstractMethod});
function AdspaceAdsFeedback(container_id) {
	var container = $(container_id);
	this.parent.construct(this, container);
	return this;
}
AdspaceAdsFeedback.extend("AdsFeedback");
copy_properties(AdspaceAdsFeedback.prototype, {_cycle_muffin:function () {
	var onResponse = function (asyncResponse) {
		var payload = asyncResponse.getPayload();
		if (payload.html) {
			this.ad_container.parentNode.innerHTML = payload.html;
		} else {
			hide(this.feedback_div);
		}
	}.bind(this);
	var onError = function (asyncResponse) {
		hide(this.feedback_div);
	}.bind(this);
	var page = URI.getRequestURI().getPath();
	ads_fetch_admarket_ad(page, null, null, onResponse, onError);
	return false;
}});
function AdspaceAdsFeedbackNew(container_id, suppress_dialog) {
	var container = $(container_id);
	this.parent.construct(this, container, suppress_dialog);
	return this;
}
AdspaceAdsFeedbackNew.extend("AdsFeedback");
copy_properties(AdspaceAdsFeedbackNew.prototype, {_cycle_muffin:function () {
	var onResponse = function (asyncResponse) {
		var payload = asyncResponse.getPayload();
		if (payload.html) {
			DOM.replace(this.ad_container, HTML(payload["html"]));
		} else {
			hide(this.feedback_div);
		}
	}.bind(this);
	var onError = function (asyncResponse) {
		hide(this.feedback_div);
	}.bind(this);
	var page = URI.getRequestURI().getPath();
	ads_fetch_admarket_ad(page, null, null, onResponse, onError);
	return false;
}});
function EmuAdsFeedback(container_id, suppress_dialog) {
	var container = $(container_id);
	this.parent.construct(this, container, suppress_dialog);
	this.disable_if_dn = true;
	return this;
}
EmuAdsFeedback.extend("AdsFeedback");
copy_properties(EmuAdsFeedback.prototype, {_cycle_muffin:function () {
	var onResponse = null;
	var onError = function (asyncResponse) {
		hide(DOM.find(this.ad_container, "div.ads_feedback"));
	}.bind(this);
	var page = URI.getRequestURI().getPath();
	ads_refresh(null, page, onResponse, onError);
	return false;
}});
function AdnetAdspaceAdsFeedback(container_id, ad_location, adnetwork_id) {
	var container = $(container_id);
	this.parent.construct(this, container);
	this.ad_location = ad_location;
	this.adnetwork_id = adnetwork_id;
	if (window.top.document.domain == window.document.domain) {
		this.dialog_parent = window.top;
	} else {
		this.dialog_parent = window;
	}
	this.buttons = this.dialog_parent.Dialog.OK_AND_CANCEL;
	return this;
}
AdnetAdspaceAdsFeedback.extend("AdsFeedback");
copy_properties(AdnetAdspaceAdsFeedback.prototype, {_thumbs_dn:function () {
	this.isPositive = false;
	this.click_usage_data = this.usage_data.clone();
	this.click_usage_data.push(AdsFeedback.K_THUMBS_DN);
	var async = new AsyncRequest().setMethod("GET").setReadOnly(true).setURI(muffinize("/muffins/ajax/feedback.php"));
	new this.dialog_parent.Dialog().setAsync(async).setButtons(this.buttons).setHandler(this._form_handler.bind(this)).show();
	return false;
}, _form_handler:function (r) {
	if (r == this.dialog_parent.Dialog.OK) {
		var reason_select = this.dialog_parent.DOM.getElement("ads_feedback_select");
		var reason_value = get_form_select_value(reason_select);
		var other_text = this.dialog_parent.DOM.getElement("ads_feedback_form_other_text").value;
		if (!this.isPositive) {
			this._disable_ad();
			this._cycle_muffin();
		}
		hide(this.thumbs_up);
		hide(this.thumbs_dn);
		this.click_usage_data.push(reason_value, other_text);
		this._log();
	}
}, _cycle_muffin:function () {
	var onResponse = function (asyncResponse) {
		var payload = asyncResponse.getPayload();
		if (payload.html) {
			DOM.replace(this.ad_container, HTML(payload["html"]));
		} else {
			hide(this.feedback_div);
		}
	}.bind(this);
	var onError = function (asyncResponse) {
		hide(this.feedback_div);
	}.bind(this);
	var page = URI.getRequestURI().getPath();
	ads_fetch_admarket_ad(page, this.ad_location, this.adnetwork_id, onResponse, onError);
	return false;
}});
function ads_feedback_select_onchange() {
	var select_elem = $("ads_feedback_select");
	var selected_index = select_elem.selectedIndex;
	if (selected_index == select_elem.options.length - 1) {
		show($("ads_feedback_form_other_text"));
	} else {
		hide($("ads_feedback_form_other_text"));
	}
}
function emu_Client(_unitId, _unitType, _contextType, _root, _iData, _frameStates, _flags, _hash) {
	this.unitId = _unitId;
	this.unitType = _unitType;
	this.contextType = _contextType;
	this.root = _root;
	this.iData = _iData;
	this.flags = _flags;
	this.hash = _hash;
	this.frameStates = {};
	this.eventFrameId = null;
	this.setStates(_frameStates);
	DataStore.set(this.root, "emuClient", this);
}
copy_properties(emu_Client, {constants:{EMU_FRAME_EVENT_INIT:1, EMU_FRAME_EVENT_CLICK:2, EMU_FRAME_EVENT_SUBMIT:3, EMU_SERVER_COMMAND_RENDER_FRAME:1000, EMU_SERVER_COMMAND_SET_FRAME_STATE:1001, EMU_SERVER_COMMAND_PLAY_VIDEO:1003, EMU_CLIENT_COMMAND_FRAME_EVENT:2000, EMU_LINK_TARGET_DEFAULT:1, EMU_LINK_TARGET_NEW_WINDOW:2, EMU_FRAME_CONTEXT_TARGET_INLINE:1, EMU_FRAME_CONTEXT_TARGET_DIALOG:2, EMU_FRAME_EVENT_HANDLER:"/ajax/emu/h.php"}, getParentDivId:function (unitId) {
	return "emu_" + unitId;
}, getClient:function (unitId) {
	var emuParent = ge(emu_Client.getParentDivId(unitId));
	if (!emuParent) {
		return null;
	}
	return DataStore.get(emuParent, "emuClient");
}});
copy_properties(emu_Client.prototype, {getFrameDivId:function (frameId) {
	return emu_Client.getParentDivId(this.unitId) + "_" + frameId;
}, _emuCmdHandler:function (asyncResponse) {
	var payload = asyncResponse.getPayload();
	for (var i = 0; i < payload.length; i++) {
		var cmd = payload[i];
		switch (cmd.cmd) {
		  case emu_Client.constants.EMU_SERVER_COMMAND_RENDER_FRAME:
			if (emu_Client.constants.EMU_FRAME_CONTEXT_TARGET_INLINE == cmd.params.surface.targetType) {
				var frameDivId = this.getFrameDivId(cmd.params.surface.targetId);
				var frame = ge(frameDivId);
				if (!frame) {
					var frame = $N("div", {"id":frameDivId});
					this.root.appendChild(frame);
				}
				set_inner_html(frame, cmd.params.surface.buffer);
			} else {
				if (emu_Client.constants.EMU_FRAME_CONTEXT_TARGET_DIALOG == cmd.params.surface.targetType) {
					if (!this.root.dialog || !this.root.dialog._showing) {
						this.root.dialog = new Dialog();
					}
					var d = this.root.dialog;
					if (cmd.params.surface.buffer) {
						d.setBody(cmd.params.surface.buffer);
					}
					if (cmd.params.surface.title) {
						d.setTitle(cmd.params.surface.title);
					}
					if (cmd.params.surface.width) {
						d.setContentWidth(cmd.params.surface.width);
					}
					d.setButtons(Dialog.OK).show();
				}
			}
			break;
		  case emu_Client.constants.EMU_SERVER_COMMAND_SET_FRAME_STATE:
			this.frameStates[cmd.params.frameId] = cmd.params.state;
			break;
		}
	}
	this.eventFrameId = null;
}, _emuErrorHandler:function (response) {
	var progressElement = ge("submit_progress_" + this.eventFrameId);
	if (progressElement) {
		CSS.addClass(progressElement, "hidden");
	}
	frameDiv = ge(this.getFrameDivId(this.eventFrameId));
	if (frameDiv) {
		var inputs = get_all_form_inputs(frameDiv);
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].disabled = false;
		}
	}
	this.eventFrameId = null;
}, setStates:function (states) {
	for (var fn in states) {
		this.frameStates[fn] = states[fn];
	}
}, onEvent:function (frameId, eventType, eventData) {
	if (this.eventFrameId) {
		return;
	}
	this.eventFrameId = frameId;
	switch (eventType) {
	  case emu_Client.constants.EMU_FRAME_EVENT_CLICK:
		var ed = eventData;
		break;
	  case emu_Client.constants.EMU_FRAME_EVENT_SUBMIT:
		var ed = serialize_form(eventData);
		var formInputs = get_all_form_inputs(eventData);
		for (var i = 0; i < formInputs.length; i++) {
			formInputs[i].disabled = true;
		}
		var progressElement = ge("submit_progress_" + this.eventFrameId);
		if (progressElement) {
			CSS.removeClass(progressElement, "hidden");
		}
		break;
	}
	var params = {"fss":this.frameStates, "ut":this.unitType, "ct":this.contextType, "f":this.flags, "x":this.hash, "ida":this.iData, "fid":frameId, "et":eventType, "ed":ed, "rt":"a"};
	var r = new AsyncRequest();
	r.setURI(emu_Client.constants.EMU_FRAME_EVENT_HANDLER).setData(params).setHandler(bind(this, "_emuCmdHandler")).setErrorHandler(bind(this, "_emuErrorHandler")).setTransportErrorHandler(bind(this, "_emuErrorHandler")).send();
}, onRedirect:function (frameId, eventData, target) {
	var f = this.root.appendChild($N("form", {"action":emu_Client.constants.EMU_FRAME_EVENT_HANDLER, "method":"POST", "target":(emu_Client.constants.EMU_LINK_TARGET_NEW_WINDOW == target) ? "_blank" : "", "style":{"display":"none"}}));
	var p = {"ut":this.unitType, "ct":this.contextType, "f":this.flags, "x":this.hash, "ida":this.iData, "fid":frameId, "et":emu_Client.constants.EMU_FRAME_EVENT_CLICK, "rt":"h"};
	for (var edt in eventData) {
		p["ed[" + edt + "]"] = eventData[edt];
	}
	for (var fn in this.frameStates) {
		p["fss[" + fn + "]"] = this.frameStates[fn];
	}
	if (ge("post_form_id")) {
		p["post_form_id"] = $("post_form_id").value;
	}
	for (var pn in p) {
		f.appendChild($N("input", {"type":"hidden", "name":pn, "value":p[pn]}));
	}
	f.submit();
	this.root.removeChild(f);
}});
function emu_redirect_wrapper(obj) {
	emu_Client.getClient(obj.adId).onRedirect(obj.frameId, obj.eventData, obj.target);
	return false;
}
function emu_action_wrapper(obj) {
	emu_Client.getClient(obj.adId).onEvent(obj.frameId, obj.eventType, obj.eventData);
	return false;
}
function SamplingDialog(sample_id, hash) {
	this.parent.construct(this);
	this.sample_id = sample_id;
	this.hash = hash;
	this._success = false;
	var uri = "/ajax/emu/sampling.php";
	var data = {"i":sample_id, "x":hash};
	this.setAsync(new AsyncRequest().setURI(uri).setData(data));
	return this;
}
SamplingDialog.extend("Dialog");
copy_properties(SamplingDialog, {getCurrent:function () {
	var d = Dialog.getCurrent();
	if (d && d instanceof SamplingDialog) {
		return d;
	} else {
		return null;
	}
}, setCurrentSuccess:function (success) {
	var d = SamplingDialog.getCurrent();
	if (d) {
		d.setSuccess(success);
	}
}});
copy_properties(SamplingDialog.prototype, {setSuccess:function (success) {
	this._success = success;
	return this;
}, setCloseHandler:function (handler) {
	this.parent.setCloseHandler(function () {
		handler(this._success);
	});
	return this;
}});
function EmuUIController(adId, frameId, state) {
	this.adId = adId;
	this.frameId = frameId;
	this.state = state;
	this.emuFrame = $("emu_" + this.adId + "_" + this.frameId);
	this.emuAd = $("emu_" + this.adId);
	DataStore.set(this.emuFrame, "emuUIController", this);
	this._init();
}
copy_properties(EmuUIController.prototype, {_init:abstractMethod, _getMoreUserContentText:abstractMethod, _initHiddenToggler:function () {
	var toggleLinks = DOM.scry(this.emuFrame, "a.emu_toggle_hidden");
	for (var i = 0; i < toggleLinks.length; i++) {
		toggleLinks[i].listen("click", this._toggleHidden.bind(this));
	}
}, _toggleHidden:function () {
	var hiddenDiv = DOM.find(this.emuFrame, "div.hidden_user_content");
	var showLink = DOM.find(this.emuFrame, "a.emu_show_hidden");
	var hideLink = DOM.find(this.emuFrame, "a.emu_hide_hidden");
	if (!shown(hiddenDiv)) {
		animation(hiddenDiv).show().from("height", 0).to("height", "auto").from("opacity", 0).to("opacity", 1).duration(200).ease(animation.ease.both).go();
		showLink.addClass("hidden");
		hideLink.removeClass("hidden");
	} else {
		animation(hiddenDiv).to("height", 0).from("opacity", 1).to("opacity", 0).hide().duration(200).ease(animation.ease.both).blind().go();
		showLink.removeClass("hidden");
		hideLink.addClass("hidden");
	}
	return false;
}});
copy_properties(EmuUIController, {getController:function (adId, frameId) {
	var emuFrame = $("emu_" + adId + "_" + frameId);
	var ret = DataStore.get(emuFrame, "emuUIController");
	return ret;
}});
function CommentableEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
}
CommentableEmuUIController.extend("EmuUIController");
copy_properties(CommentableEmuUIController.prototype, {_getCommentInput:abstractMethod, _init:function () {
	this._initCommentHandlers();
	this._initHiddenToggler();
}, _initCommentHandlers:function () {
	var commentInput = this._getCommentInput();
	if (commentInput) {
		commentInput.listen("focus", this._commentOnFocus.bind(this));
	}
	var submitBtn = DOM.scry(this.emuFrame, "input.submit_post")[0];
	if (submitBtn) {
		submitBtn.listen("click", this._commentOnSubmit.bind(this));
	}
}, _commentOnFocus:function () {
	var submitBtn = DOM.find(this.emuFrame, "input.submit_post");
	submitBtn.disabled = false;
	submitBtn.removeClass("hidden");
}, _commentOnSubmit:function (evt) {
	var commentInput = this._getCommentInput();
	var comment = commentInput.value;
	var placeholder = commentInput.getControl().getPlaceholderText();
	if (!comment || (comment == placeholder)) {
		$E(evt).kill();
	} else {
		var progress = DOM.find(this.emuFrame, "img.submit_progress");
		progress.removeClass("hidden");
	}
}});
function CommentEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	this.LINK_DELETE_COMMENT = 1;
	return this;
}
CommentEmuUIController.extend("CommentableEmuUIController");
copy_properties(CommentEmuUIController.prototype, {_init:function () {
	this.parent._init();
	var show_link = DOM.scry(this.emuFrame, "a.emu_comments_show");
	if (show_link.length > 0) {
		show_link = show_link[0];
		var show_div = DOM.find(this.emuFrame, "div.emu_comments_more_div");
		var more_comments = DOM.find(this.emuFrame, "div.hidden_user_content");
		show_link.listen("click", function () {
			show_div.addClass("hidden");
			more_comments.removeClass("hidden");
			return false;
		});
	}
}, deleteComment:function (comment_id) {
	new Dialog().setTitle(_tx("Delete Comment")).setBody(_tx("Are you sure you want to delete this comment?")).setButtons([{name:"delete", label:_tx("Delete"), handler:bind(this, function () {
		var data = {linkId:this.LINK_DELETE_COMMENT, linkParam:comment_id};
		emu_Client.getClient(this.adId).onEvent(this.frameId, emu_Client.constants.EMU_FRAME_EVENT_CLICK, data);
	})}, Dialog.CANCEL]).show();
}, focus:function () {
	this._getCommentInput().focus();
	return false;
}, _getMoreUserContentText:function (numHidden) {
	if (numHidden == 1) {
		return _tx("1 more comment");
	} else {
		return _tx("{count} more comments", {"count":numHidden});
	}
}, _getCommentInput:function () {
	return DOM.scry(this.emuFrame, "input[name=\"comment\"]")[0];
}});
function GiftEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	return this;
}
GiftEmuUIController.extend("CommentableEmuUIController");
copy_properties(GiftEmuUIController.prototype, {_init:function () {
	this.parent._init();
	this._adjustGiftsInIE6();
}, _adjustGiftsInIE6:function () {
	if (!(ua.ie() < 7)) {
		return;
	}
	var giftImgs = DOM.scry(this.emuFrame, "img.wall_mini_gift_image");
	var hiddenDiv = DOM.scry(this.emuFrame, "div.hidden_user_content")[0];
	if (hiddenDiv) {
		hiddenDiv.removeClass("hidden");
	}
	for (var i = 0; i < giftImgs.length; i++) {
		var giftImg = giftImgs[i];
		giftImg.setStyle("width", giftImg.offsetWidth + 1 + "px");
		giftImg.setStyle("height", giftImg.offsetHeight + 1 + "px");
		adjustImage(giftImg);
	}
	if (hiddenDiv) {
		hiddenDiv.addClass("hidden");
	}
}, _getMoreUserContentText:function (numHidden) {
	if (numHidden == 1) {
		return _tx("1 more gift");
	} else {
		return _tx("{count} more gifts", {"count":numHidden});
	}
}, _getCommentInput:function () {
	return DOM.scry(this.emuFrame, "textarea[name=\"gift_message\"]")[0];
}});
copy_properties(GiftEmuUIController, {onFriendTokenAdded:function (formId, token) {
	var formDiv = $(formId);
	var giftTo = DOM.find(formDiv, "input[name=\"gift_to\"]");
	giftTo.value = token.i;
	CSS.removeClass(DOM.find(formDiv, "div.gift_msg_and_submit"), "hidden");
	CSS.removeClass(DOM.find(formDiv, "div.gift_form_submit"), "hidden");
}, onFriendTokenRemoved:function (formId, token) {
	var formDiv = $(formId);
	var giftTo = DOM.find(formDiv, "input[name=\"gift_to\"]");
	giftTo.value = null;
}});
function InviteEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	return this;
}
InviteEmuUIController.extend("CommentableEmuUIController");
copy_properties(InviteEmuUIController.prototype, {_init:function () {
	this.parent._init();
}, _getCommentInput:function () {
	return DOM.scry(this.emuFrame, "input[name=\"email_list\"]")[0];
}});
function TagEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	return this;
}
TagEmuUIController.extend("CommentableEmuUIController");
copy_properties(TagEmuUIController.prototype, {_init:function () {
	this.parent._init();
}, _getCommentInput:function () {
	return DOM.scry(this.emuFrame, "input[name=\"tag\"]")[0];
}});
function EventEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	return this;
}
EventEmuUIController.extend("CommentableEmuUIController");
copy_properties(EventEmuUIController, {EVENT_STATE_INITIAL:1, EVENT_STATE_JUST_RSVP:2, EVENT_ACTION_LINK_TO_EVENT:1, EVENT_ACTION_LINK_RSVP:2});
copy_properties(EventEmuUIController.prototype, {_init:function () {
	var changeRSVPLink = DOM.scry(this.emuFrame, "a.rsvp_change")[0];
	if (changeRSVPLink) {
		changeRSVPLink.listen("click", this._change_rsvp.bind(this));
	}
	var rsvpRadios = DOM.scry(this.emuFrame, "input[name=\"rsvp_status_dummy\"]");
	if (rsvpRadios) {
		for (var i = 0; i < rsvpRadios.length; i++) {
			var radio = rsvpRadios[i];
			radio.listen("click", this._rsvp.bind(this, radio));
		}
	}
	if (this.state == EventEmuUIController.EVENT_STATE_JUST_RSVP) {
		this._updateRsvpStatusBg();
		this._initCommentHandlers();
	}
	this._initHiddenToggler();
}, _change_rsvp:function () {
	var rsvpStatus = DOM.find(this.emuFrame, "div.rsvp_status");
	var rsvpInputs = DOM.find(this.emuFrame, "div.rsvp_inputs");
	var rsvpChange = DOM.find(this.emuFrame, "a.rsvp_change");
	CSS.addClass(rsvpStatus, "hidden");
	CSS.addClass(rsvpChange, "hidden");
	CSS.removeClass(rsvpInputs, "hidden");
	return false;
}, _rsvp:function (radioInput) {
	var rsvpInputs = DOM.find(this.emuFrame, "div.rsvp_inputs");
	var progress = DOM.find(this.emuFrame, "img.rsvp_progress");
	var data = {"linkId":EventEmuUIController.EVENT_ACTION_LINK_RSVP, "linkParam":radioInput.value};
	emu_Client.getClient(this.adId).onEvent(this.frameId, emu_Client.constants.EMU_FRAME_EVENT_CLICK, data);
	CSS.addClass(rsvpInputs, "hidden");
	CSS.removeClass(progress, "hidden");
}, _updateRsvpStatusBg:function () {
	var statusPhrase = DOM.find(this.emuFrame, "span.rsvp_status_phrase");
	animation(statusPhrase).to("backgroundColor", "#FFFFFF").from("#FFE8CC").duration(3000).go();
}, _getCommentInput:function () {
	return DOM.scry(this.emuFrame, "textarea[name=\"rsvp_comment\"]")[0];
}, _getMoreUserContentText:function (numHidden) {
	if (numHidden == 1) {
		return _tx("1 more RSVP from a friend");
	} else {
		return _tx("{count} more RSVPs from friends", {"count":numHidden});
	}
}});
copy_properties(EventEmuUIController, {onFriendTokenAdded:function (formId, token) {
	var formDiv = $(formId);
	CSS.removeClass(DOM.find(formDiv, "div.invite_form_message"), "hidden");
	CSS.removeClass(DOM.find(formDiv, "div.invite_form_submit"), "hidden");
}});
function FanEmuUIController(adId, frameId, state) {
	this.parent.construct(this, adId, frameId, state);
	return this;
}
FanEmuUIController.extend("EmuUIController");
copy_properties(FanEmuUIController.prototype, {_init:function () {
	this._initHiddenToggler();
}, _getMoreUserContentText:function (numHidden) {
	numHidden -= 3;
	if (numHidden == 1) {
		return _tx("1 more fan");
	} else {
		return _tx("{count} more fans", {"count":numHidden});
	}
}, justFanned:function () {
	var fanText = DOM.find(this.emuFrame, "div.fan_action");
	fanText.setStyle("backgroundColor", "#fffccc");
	animation(fanText).duration(3000).checkpoint().to("backgroundColor", "#FFFFFF").duration(1000).go();
}});
function PollEmuUIController(adId, frameId, state, isNile) {
	this.isNile = isNile;
	this.parent.construct(this, adId, frameId, state);
	return this;
}
PollEmuUIController.extend("EmuUIController");
copy_properties(PollEmuUIController, {STATE_INITIAL:1, STATE_SHOW_QUESTION:2, STATE_JUST_ANSWERED:3, STATE_ANSWERED:4, LINK_TO_SUBMIT:1, LINK_SHOW_QUESTION:2});
copy_properties(PollEmuUIController.prototype, {animateResults:function () {
	var resultBars = DOM.scry(this.emuFrame, "div.result_bar");
	for (var i = 0; i < resultBars.length; i++) {
		var bar = resultBars[i];
		var width = bar.offsetWidth;
		bar.setStyle("width", "0px");
		animation(bar).from("width", 0).to("width", width).duration(500).ease(animation.ease.both).go();
	}
}, _init:function () {
	if (this.state == PollEmuUIController.STATE_SHOW_QUESTION) {
		this._initAnswerRadios();
	} else {
		var friendCountLink = DOM.scry(this.emuFrame, "a.friend_count_link")[0];
		if (friendCountLink) {
			friendCountLink.listen("click", this._onShowFriendsClick.bind(this));
		}
	}
}, _initAnswerRadios:function () {
	var answerRadios = DOM.scry(this.emuFrame, "div.poll_choice input.inputradio");
	if (answerRadios) {
		for (var i = 0; i < answerRadios.length; i++) {
			var radio = answerRadios[i];
			radio.listen("click", this._onAnswer.bind(this, radio));
		}
	}
}, _onShowFriendsClick:function () {
	var friendVotePics = DOM.scry(this.emuFrame, "div.friend_vote_pics");
	for (var i = 0; i < friendVotePics.length; i++) {
		var friendVotePic = friendVotePics[i];
		if (!shown(friendVotePic)) {
			animation(friendVotePic).from("height", 0).to("height", "auto").duration(200).show().go();
		} else {
			animation(friendVotePic).to("height", 0).duration(200).hide().go();
		}
	}
	return false;
}, _onAnswer:function (radioInput) {
	var answerId = radioInput.value;
	var container = DOM.find(this.emuFrame, "div.poll_choices");
	var progress = DOM.find(this.emuFrame, "img.submit_progress");
	var radioArr = DOM.scry(container, "input.inputradio");
	var OFFSET_X = 0;
	var radioVector = Vector2.getElementPosition(radioInput);
	var containerVector = Vector2.getElementPosition(container);
	var progressVector = new Vector2(OFFSET_X, radioVector.y - containerVector.y, "document");
	for (var i = 0; i < radioArr.length; i++) {
		radioArr[i].disabled = true;
	}
	progressVector.setElementPosition(progress);
	radioInput.setStyle("visibility", "hidden");
	progress.removeClass("hidden");
	var data = {"linkId":PollEmuUIController.LINK_TO_SUBMIT, "linkParam":answerId};
	emu_Client.getClient(this.adId).onEvent(this.frameId, emu_Client.constants.EMU_FRAME_EVENT_CLICK, data);
}});
function SampleEmuUIController(adId, frameId, state, sampleId, hash) {
	this.parent.construct(this, adId, frameId, state);
	this.sampleId = sampleId;
	this.hash = hash;
	this.LINK_OPEN_DIALOG = 1;
	this.LINK_TO_FRIEND = 2;
	this.LINK_SUBMIT_DIALOG = 3;
}
SampleEmuUIController.extend("EmuUIController");
copy_properties(SampleEmuUIController.prototype, {_init:function () {
	var link = DOM.find(this.emuFrame, "a.sample_dialog_open_link");
	var clickHandler = function () {
		new SamplingDialog(this.sampleId, this.hash).setCloseHandler(this.dialogCloseHandler.bind(this)).show();
		emu_Client.getClient(this.adId).onEvent(this.frameId, emu_Client.constants.EMU_FRAME_EVENT_CLICK, {"linkId":this.LINK_OPEN_DIALOG});
		return false;
	}.bind(this);
	link.listen("click", clickHandler);
}, dialogCloseHandler:function (success) {
	if (success) {
		emu_Client.getClient(this.adId).onEvent(this.frameId, emu_Client.constants.EMU_FRAME_EVENT_CLICK, {"linkId":this.LINK_SUBMIT_DIALOG});
	}
}});
function emu_ClickableBody(emu_container) {
	var title = DOM.scry(emu_container, "a.ad_title");
	var clickableBody = DOM.scry(emu_container, "a.clickable_body");
	if (title.length && clickableBody.length) {
		title = title[0];
		clickableBody = clickableBody[0];
		clickableBody.listen("mouseover", function () {
			CSS.addClass(title, "underlined_title");
		});
		clickableBody.listen("mouseout", function () {
			CSS.removeClass(title, "underlined_title");
		});
	}
}
function tz_calculate(timestamp) {
	var d = new Date();
	var raw_offset = d.getTimezoneOffset() / 30;
	var time_sec = d.getTime() / 1000;
	var time_diff = Math.round((timestamp - time_sec) / 1800);
	var rounded_offset = Math.round(raw_offset + time_diff) % 48;
	if (rounded_offset == 0) {
		return 0;
	} else {
		if (rounded_offset > 24) {
			rounded_offset -= Math.ceil(rounded_offset / 48) * 48;
		} else {
			if (rounded_offset < -28) {
				rounded_offset += Math.ceil(rounded_offset / -48) * 48;
			}
		}
	}
	return rounded_offset * 30;
}
function ajax_tz_set(tzForm) {
	var timestamp = tzForm.time.value;
	var gmt_off = -tz_calculate(timestamp);
	var cur_gmt_off = tzForm.tz_gmt_off.value;
	if (gmt_off != cur_gmt_off) {
		var ajaxUrl = "/ajax/autoset_timezone_ajax.php";
		new AsyncSignal(ajaxUrl, {user:tzForm.user.value, gmt_off:gmt_off}).send();
	}
}
function tz_autoset() {
	var tz_form = ge("tz_autoset_form");
	if (tz_form) {
		ajax_tz_set(tz_form);
	}
}
function VideoLightbox(video_id, player_type, ad_target, emu_connect) {
	var async = new AsyncRequest().setMethod("GET").setReadOnly(true).setData({v:video_id, player_type:player_type, target:ad_target, emu_connect:emu_connect}).setURI("/ajax/video/lightbox.php");
	this.dialog = new Dialog().setClassName("lightbox").setFullBleed().setAsync(async).setClickoutCloseModal().show();
}
VideoLightbox.prototype.toggle = function () {
	if (this.interactions.hasClass("hidden_elem")) {
		this.interactions.removeClass("hidden_elem");
	} else {
		this.interactions.addClass("hidden_elem");
	}
};
if (window.Bootloader) {
	Bootloader.done(["js/2rv9bxgqaneog8w4.pkg.js"]);
}

